[code-simplifier] Extract action mode helper to reduce code duplication #13982
+12
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Code Simplification - 2026-02-05
This PR simplifies recently modified code to improve clarity, consistency, and maintainability while preserving all functionality.
Files Simplified
pkg/workflow/action_mode.go- AddedGetActionModeFromWorkflowData()helper functionpkg/workflow/copilot_mcp.go- SimplifiedcreateRendererclosure to use helperpkg/workflow/claude_mcp.go- SimplifiedcreateRendererclosure to use helperpkg/workflow/codex_mcp.go- SimplifiedcreateRendererclosure to use helperpkg/workflow/custom_engine.go- SimplifiedcreateRendererclosure to use helperImprovements Made
Reduced Duplication
Enhanced Clarity
createRendererclosuresApplied Project Standards
Changes Based On
Recent changes from:
Testing
The changes are purely structural and preserve exact functionality:
Review Focus
Please verify:
Context: This simplification addresses code duplication introduced in PR #13974, which added
ActionModepropagation to MCP renderers. All four engine files (Copilot, Claude, Codex, Custom) had identical 4-line blocks for extracting action mode from workflow data. This PR consolidates that logic into a single, reusable helper function.Benefits:
Testing Strategy: Since this is a pure refactoring with no behavioral changes, the existing test suite validates correctness. The helper function uses the same logic (nil check with default to
ActionModeDev) that was previously inline in each file.